package com.atguigu.controller;

import com.atguigu.entity.Stu;
import com.atguigu.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HelloController {

    @Autowired
    private StuService stuService;

    @GetMapping("")
    public String hello(){
        System.out.println("HelloController.hello");
        return "hello springmvc!!";
    }

    @GetMapping("/stu/list")
    public List<Stu> getAllStudents() {
        System.out.println("获取所有学生信息");
        return stuService.getAllStudents();
    }
}